package com.py.ledger.controller;

import java.util.List;
import java.io.IOException;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

import com.py.message.MessageProducer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.py.ledger.domain.InventoryDetails;
import com.py.ledger.service.IInventoryDetailsService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;

/**
 * 库存预警Controller
 * 
 * @author he
 * @date 2024-11-29
 */
@RestController
@RequestMapping("/details")
public class InventoryDetailsController extends BaseController
{
    @Autowired
    private IInventoryDetailsService inventoryDetailsService;


    @GetMapping("/inventory")
    public List<InventoryDetails>  selectInventoryDetails(){
        System.out.println(inventoryDetailsService.selectLedgerDetail());
        return inventoryDetailsService.selectLedgerDetail();
    }


    /**
     * 查询库存预警列表
     */
    @RequiresPermissions("ledger:details:list")
    @GetMapping("/list")
    public TableDataInfo list(InventoryDetails inventoryDetails) {
        startPage();
        List<InventoryDetails> list = inventoryDetailsService.selectInventoryDetailsList(inventoryDetails);
        return getDataTable(list);
    }

    /**
     * 获取库存预警详细信息
     */
    @RequiresPermissions("ledger:details:query")
    @GetMapping(value = "/{inventoryQueryId}")
    public AjaxResult getInfo(@PathVariable("inventoryQueryId") Long inventoryQueryId)
    {
        return success(inventoryDetailsService.selectInventoryDetailsByInventoryQueryId(inventoryQueryId));
    }

}
